﻿@using E5_KhuyenMaiVang.Models

@model IEnumerable<E5_KhuyenMaiVang.Models.COMPANY>

@{
    ViewBag.Title = "DN_QuanLy";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
    string Error = null;
    Error = ViewBag.Error;
    int i = 0;
    GoldDealEntities db = new GoldDealEntities();
    List<COMPANY> ListItems = db.COMPANY.ToList();
}

@section menu
{
    <h3>Admin</h3>
    <ul class="nav">       
          <li><a href="@Url.Action("DN_QuanLy","Admin")"  style="text-decoration:underline; font-weight:bold;">Quản lý doanh nghiệp</a></li>
          <li><a href="@Url.Action("DN_Them","Admin")">Thêm doanh nghiệp</a></li>
   </ul>
}
    
                <div class="top-bar">
                    <a href="#" class="button">ADD NEW </a>
                    <h1>DOANH NGHIỆP</h1>
                    <div class="breadcrumbs"><a href="#">Doanh nghiệp</a> / <a href="#">Quản lý doanh nghiệp</a></div>
                </div>

                <form method="post" action="@Url.Action("SearchCompany","Admin")">
                <div class="select-bar">
                    <label>
                        <input type="text" data-autocomplete="@Url.Action("AutoCompleteData", "Admin")" id="tags" name="CompanyName" style="z-index: 100; position: relative" title="type &quot;a&quot;" />
                    </label>
                    <label>
                        <input type="submit" name="Submit" value="Search" />
                    </label>
                </div>
                </form>
                @if (ViewBag.Error != null) { 
                    <div class="ui-widget">
			<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
				<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
				<strong>Alert:</strong> @ViewBag.Error</p>
			</div>
		</div>
                }
                @if (ViewBag.Success != null) { 
                <div class="ui-widget">
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>Hey!</strong> ViewBag.Success</p>
			</div>
		</div>
                }
          <div class="table">
<table class="listing" cellpadding="0" cellspacing="0">
                        <tr>
                            <th width="5%">Số thứ tự</th>
                            <th width="10%">Tên doanh nghiệp</th>
                            <th width="10%">Mã số thuế</th>
                            <th width="10%">Email</th>
                            <th width="20%">Địa chỉ</th>
                            <th width="10%">Số điện thoại</th>
                            <th width="25%">Mô tả</th>                    
                            <th width="5%">Sửa</th>                            
                            <th width="5%">Xóa</th>
                        </tr>

                        @foreach (var item in Model)
                        {
                            <tr>
                            <td class="style1">@(++i)</td>
                            <td>@item.CompanyName</td>
                            <td>@item.TaxCode</td>
                             <td>@item.Email</td>
                            <td>@item.Address</td>
                            <td>@item.Phone</td>
                            <td>@item.Description</td>
                            <td><a href="@Url.Action("DN_CapNhat", "Admin", new { companyID = @item.CompanyID })"><img src="../Images/edit-icon.gif" width="16" height="16" alt="" /></a></td>
                            <td><a href="@Url.Action("DN_Xoa", "Admin", new { companyID = @item.CompanyID })"><img src="../Images/hr.gif" width="16" height="16" alt="" /></a></td>                            
                        </tr>
                        }
                        
            </table>
          </div>

   <script>      
          $(document).ready(function  () {
     $('#tags').each(function  () {
         $(this ).autocomplete({ source: $(this ).attr('data-autocomplete') });
     });
 });
 </script>